Xbasic

time_to_unixtimestamp Function

Syntax

Result as N = time_to_unixTimeStamp(T timevalue )

Arguments

timevalueTime

A time value to convert to a Unix timestamp.

Returns

ResultNumeric

Returns a Unix timestamp value.

Description

Converts a time value to a Unix timestamp value.

A unix timestamp is typically referred to as "Epoch" time, and is normally calculated from GMT (or UTC time), so the time passed into the function should be GMT time to get Epoch time.

Example to get current Epoch time:

dim currTime as T
dim getGMTTime as L
getGMTTime = .T.

currTime = now(getGMTTime)
? currTime
= 03/20/2017 10:07:39 45 pm

? time_to_unixtimestamp(currTime)
= 1490047659.459

See Also